package demo03;

import java.util.Arrays;
import java.util.Scanner;

public class insertSort {
    public static void main(String[] args) {
        insertSort();
    }

    public static void insertSort() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0;i < n;i++){
            arr[i] = sc.nextInt();
        }
        for(int i = 1;i < arr.length;i++){
            int tmp = arr[i];
            int j = i;
            while(j > 0 && tmp < arr[j - 1]) {
                arr[j] = arr[j - 1];
                j--;
            }
            if(j != i) {
                arr[j] = tmp;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
